﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SmallSoft.Language.Presenter.Interface;
using SmallSoft.Language.Database;
using SmallSoft.Language.Model.Interface;

namespace SmallSoft.Language.Presenter
{
    public class MainAppPresenter:IMainAppPresenter
    {
        private IList<IWordModel> dict;

        public void GetDicts()
        {
            DatabaseAccessBase dbAccess = DatabaseAccessFactory.GetDatabaseAccess(eDatabaseAccess.DA_EXCELFILE);
            Dict=dbAccess.GetListWord();
        }

        public IList<IWordModel> Dict
        {
            get
            {
                return dict;
            }
            set
            {
                dict = value;
            }
        }


        public IWordModel GetRandomWord()
        {          
            Random rd=new Random();           
            return dict[rd.Next(dict.Count)];
        }
    }
}
